package entity

import (
	"shqsoft.cn/pasnj/base"

	"github.com/jinzhu/gorm"
)

//SJSHXFDDR 房贷导入
type SJSHXFDDR struct {
	ID    int     `gorm:"AUTO_INCREMENT;primary_key;column:ID"`
	KHYF  int     `gorm:"column:KHYF"`
	JJH   string  `gorm:"column:JJH"`
	KHMC  string  `gorm:"column:KHMC"`
	YWPZ  string  `gorm:"column:YWPZ"`
	RJ    float64 `gorm:"column:RJ"`
	ZXYL  float64 `gorm:"column:ZXYL"`
	ZXNL  float64 `gorm:"column:ZXNL"`
	SFSP  float64 `gorm:"column:SFSP"`
	KHJL1 string  `gorm:"column:KHJL1"`
	ZB1   float64 `gorm:"column:ZB1"`
	KHJL2 string  `gorm:"column:KHJL2"`
	ZB2   float64 `gorm:"column:ZB2"`
	KHJL3 string  `gorm:"column:KHJL3"`
	ZB3   float64 `gorm:"column:ZB3"`
	KHJL4 string  `gorm:"column:KHJL4"`
	ZB4   float64 `gorm:"column:ZB4"`
	DRJG  string  `gorm:"column:DRJG"`
}

//TableName 房贷导入
func (SJSHXFDDR) TableName() string {
	return "T_BASE_YXFY_SJSHXFD_DTIP"
}

//SjshxfdAfterImport 导入后执行分户处理
func SjshxfdAfterImport(tx *gorm.DB, params map[string]string) (err error) {
	prams := make([]interface{}, 1)
	prams[0] = params["KHYF"]
	tx.Exec("EXEC UP_BASE_YXFY_SJSHXFD_DTIP ?", prams...)
	return nil
}

//SJSHXFDDREF 返回结构体
func SJSHXFDDREF() base.EntityFunc {
	return func() interface{} {
		entity := SJSHXFDDR{}
		return &entity
	}
}

//SJSHXFDDRESF 返回结构体数组
func SJSHXFDDRESF() base.EntitiesFunc {
	return func() interface{} {
		var entities []SJSHXFDDR
		return &entities
	}
}

func init() {
	base.DaoPoolObj.Put("SJSHXFDDR", base.NewDefaultDao(SJSHXFDDREF(), SJSHXFDDRESF(), nil))
	base.SetAfterCallBack("SJSHXFDDR", SjshxfdAfterImport)
}
